<html>
  <head>
  <title>Add or Edit a student</title>
    <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
    <link type="text/css" rel="stylesheet" href="/stylesheets/question_search.css" />
 <script language="JavaScript">
	function CheckAndSubmit() {		
		// Check value ranges for name-field
		// TODO: also detect if not IsWhiteSpaces(strStudentName)
		var elStudentName  = document.getElementById("name");		
		var strStudentName = elStudentName.value;		
		
		if (strStudentName ==="") {
			elStudentName.focus(); elStudentName.select();
			alert("'Name' can't be empty.");     			
			return false;
  		}	
		//alert("Submit: " +strStudentName);
		document.frmEditStudent.submit();
	}
</script>
</head>
  <body>
      <div><h2>Create or Edit a student</h2></div>
      <form action="/student_submit" method="post" id="frmEditStudent" name="frmEditStudent"></br>
      <hr><br/>
      <div><input type="hidden" name="id" value="{{ id }}"></div>
     
      <div class="labelEdit">Name </div><input  class="myTextInput" type="text" id="name"  name="name"  value="{{ name }}"></div>
      <br>
      <div class="labelEdit">Email</div><input  class="myTextInput" type="text" id="email" name="email" value="{{ email }}"></div>
      <br/>
      <hr>	
      <div><input class="myButton" onClick="CheckAndSubmit();" type="button" id="Save" value="Save"></div>
    </form>
<br><a href="/students_browse">Students browser</a><br><hr>
<br><br><a href="/">Start page</a>  
</body>
</html>

